package shape;

import java.awt.Color;

import color.ColorCheck;

/**
 * Implements Rectangle object
 * */
public class Rectangle
{
    
    // Attributes of the Rectangle object
    private double x;
    private double y;
    private double width;
    private double height;
    private Color  fillColor;
    private Color  stroke;
    private double strokeWidth;
    ColorCheck     ck = new ColorCheck();
    
    /**
     * 
     * @param x
     *            horizontal distance to Rectangle from (0,0)
     * @param y
     *            vertical distance to Rectangle from (0,0)
     * @param width
     *            width of the Rectangle
     * @param height
     *            height of the Rectangle
     */
    public Rectangle(double x, double y, double width, double height)
    {
        
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.fillColor = Color.black;
    }
    
    /**
     * 
     * @param x
     *            horizontal distance to Rectangle from (0,0)
     * @param y
     *            vertical distance to Rectangle from (0,0)
     * @param width
     *            width of the Rectangle
     * @param height
     *            height of the Rectangle
     * @param fillcolor
     *            filling color of the Rectangle
     */
    
    public Rectangle(double x, double y, double width, double height,
            String fillColor)
    {
        
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.fillColor = ck.getColor(fillColor);
        
    }
    
    /**
     * 
     * @param x
     *            horizontal distance to Rectangle from (0,0)
     * @param y
     *            vertical distance to Rectangle from (0,0)
     * @param width
     *            width of the Rectangle
     * @param height
     *            height of the Rectangle
     * @param fillcolor
     *            filling color of the Rectangle
     * @param strokeWidth
     *            stroke Width of the Rectangle
     */
    
    public Rectangle(double x, double y, double width, double height,
            String fillColor, double strokeWidth)
    {
        
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.fillColor = ck.getColor(fillColor);
        this.strokeWidth = strokeWidth;
        this.stroke = Color.red;
    }
    
    /**
     * 
     * @param x
     *            horizontal distance to circle from (0,0)
     * @param y
     *            vertical distance to circle from (0,0)
     * @param width
     *            width of the Rectangle
     * @param height
     *            height of the Rectangle
     * @param fillcolor
     *            filling color of the Rectangle
     * @param strokeColor
     *            stroke color of the Rectangle
     * @param strokeWidth
     *            stroke Width of the Rectangle
     */
    public Rectangle(double x, double y, double width, double height,
            String fillColor, String strokeColor, double strokeWidth)
    {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.fillColor = ck.getColor(fillColor);
        this.stroke = ck.getColor(strokeColor);
        this.strokeWidth = strokeWidth;
        
    }
    
    public double getStrokeWidth()
    {
        return strokeWidth;
    }
    
    public double getX()
    {
        return x;
    }
    
    public double getY()
    {
        return y;
    }
    
    public double getWidth()
    {
        return width;
    }
    
    public double getHeight()
    {
        return height;
    }
    
    public Color getFillColor()
    {
        return fillColor;
    }
    
    public Color getStroke()
    {
        return stroke;
    }
    
    // Prints Rectangle details for debugging
    public void print()
    {
        
        System.out.println("Rectangle");
        System.out.println("x  = " + this.x);
        System.out.println("y  = " + this.y);
        System.out.println("width = " + this.width);
        System.out.println("height = " + this.height);
        System.out.println("fillColor = " + this.fillColor);
        System.out.println("stroke = " + this.stroke);
        System.out.println("strokeWidth = " + this.strokeWidth);
    }
    
}
